/** font-family 選用字型設定感謝 胡雨晴 hafterain (https://github.com/hafterain) 提供幫助 ❤️❤️❤️ */

:root,
:host {
  --bew-fonts-basic: bilifont, -apple-system, BlinkMacSystemFont, Inter, "Segoe UI Variable", "Segoe UI", "Roboto Flex",
    Roboto, "Noto Sans", Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue";
  --bew-fonts-fallback: system-ui, Arial, sans-serif;

  --bew-fonts-english: var(--bew-fonts-basic), var(--bew-fonts-fallback);
  --bew-fonts-mandarin-cn: var(--bew-fonts-basic), "PingFang SC", "Source Han Sans SC VF", "Noto Sans CJK SC",
    "Source Han Sans SC", "Microsoft YaHei", var(--bew-fonts-fallback);
  // TODO: 使用 CDN 載入思源黑體 to prevent 弱撚智 Microsoft JhengHei 視覺干擾
  /* Microsoft JhengHei 是我見過最腦殘弱智的字型，預設下文字太細，但是 windows 正體中文又預設用這個黑體渲染，能用 cdn 換字型就換 */
  --bew-fonts-mandarin-tw: var(--bew-fonts-basic), "PingFang TC", "Source Han Sans TC VF", "Noto Sans CJK TC",
    "Source Han Sans TC", "Microsoft JhengHei", var(--bew-fonts-fallback);
  /* Microsoft JhengHei 是我見過最腦殘弱智的字型，預設下文字太細，但是 windows 正體中文又預設用這個黑體渲染，能用 cdn 換字型就換 */
  --bew-fonts-cantonese: var(--bew-fonts-basic), "PingFang HK", "Source Han Sans HC VF", "Noto Sans CJK HK",
    "Source Han Sans HC", "Microsoft JhengHei", var(--bew-fonts-fallback);
}

.bewly-wrapper,
.bewly-design {
  code,
  kbd,
  samp,
  pre {
    font-family: "JetBrains Mono", "Fira Code", "Fira Mono", "Cascadia Code", "Cascadia Mono", ui-monospace,
      SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  }
}

:lang(en) .bewly-wrapper,
:lang(en).bewly-design,
// Do not change the danmaku font because the Bilibili video player can change the font of danmaku
:lang(en).bewly-design *:not(.bili-danmaku-x-dm),
// 热搜点评
:lang(en).bewly-design .base-video-sections-v1 .video-sections-head_first-line .first-line-left .first-line-title,
// 接下来播放
:lang(en).bewly-design .recommend-list-v1 .rec-title,
// Font for the recommended video list on the right side of the video https://github.com/BewlyBewly/BewlyBewly/issues/1061
:lang(en).bewly-design .card-box .info .title,
// Search page video card title https://search.bilibili.com/all?keyword=test
:lang(en).bewly-design .bili-video-card .bili-video-card__info--tit {
  font-family: var(--bew-font-family, var(--bew-fonts-english));
}

:lang(zh-CN) .bewly-wrapper,
:lang(zh-CN).bewly-design,
// Do not change the danmaku font because the Bilibili video player can change the font of danmaku
:lang(zh-CN).bewly-design *:not(.bili-danmaku-x-dm),
// 热搜点评
:lang(zh-CN).bewly-design .base-video-sections-v1 .video-sections-head_first-line .first-line-left .first-line-title,
// 接下来播放
:lang(zh-CN).bewly-design .recommend-list-v1 .rec-title,
// Font for the recommended video list on the right side of the video https://github.com/BewlyBewly/BewlyBewly/issues/1061
:lang(zh-CN).bewly-design .card-box .info .title,
// Search page video card title https://search.bilibili.com/all?keyword=test
:lang(zh-CN).bewly-design .bili-video-card .bili-video-card__info--tit {
  font-family: var(--bew-font-family, var(--bew-fonts-mandarin-cn));
}

:lang(zh-TW) .bewly-wrapper,
:lang(zh-TW).bewly-design,
// Do not change the danmaku font because the Bilibili video player can change the font of danmaku
:lang(zh-TW).bewly-design *:not(.bili-danmaku-x-dm),
// 热搜点评
:lang(zh-TW).bewly-design .base-video-sections-v1 .video-sections-head_first-line .first-line-left .first-line-title,
// 接下来播放
:lang(zh-TW).bewly-design .recommend-list-v1 .rec-title,
// Font for the recommended video list on the right side of the video https://github.com/BewlyBewly/BewlyBewly/issues/1061
:lang(zh-TW).bewly-design .card-box .info .title,
// Search page video card title https://search.bilibili.com/all?keyword=test
:lang(zh-TW).bewly-design .bili-video-card .bili-video-card__info--tit {
  font-family: var(--bew-font-family, var(--bew-fonts-mandarin-tw));
}

:lang(zh-HK) .bewly-wrapper,
:lang(zh-HK).bewly-design,
// Do not change the danmaku font because the Bilibili video player can change the font of danmaku
:lang(zh-HK).bewly-design *:not(.bili-danmaku-x-dm),
// 热搜点评
:lang(zh-HK).bewly-design .base-video-sections-v1 .video-sections-head_first-line .first-line-left .first-line-title,
// 接下来播放
:lang(zh-HK).bewly-design .recommend-list-v1 .rec-title,
// Font for the recommended video list on the right side of the video https://github.com/BewlyBewly/BewlyBewly/issues/1061
:lang(zh-HK).bewly-design .card-box .info .title,
// Search page video card title https://search.bilibili.com/all?keyword=test
:lang(zh-HK).bewly-design .bili-video-card .bili-video-card__info--tit {
  font-family: var(--bew-font-family, var(--bew-fonts-cantonese));
}

// // 不知道爲何 firefox 用下面這一段樣式優先級別會高過的樣式，先註釋先了
// .bewly-wrapper,
// .bewly-design,
// .bewly-design *:not(.bili-danmaku-x-dm) {
//   font-family: var(--bew-font-family, var(--bew-fonts-english));
// }
